package com.chinairi.mall.service;

import com.chinairi.mall.controller.viewobject.*;
import com.chinairi.mall.excelParam.ExcelOrderInfo;
import com.chinairi.mall.model.OrderInfo;
import com.baomidou.mybatisplus.extension.service.IService;
import com.chinairi.mall.service.modelobject.OrderInfoMO;
import com.chinairi.mall.service.modelobject.OrderServiceGoodsMO;

import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 订单表,由于order是MYSQL的关键字，所以换名 服务类
 * </p>
 *
 * @author gsl
 * @since 2020-09-30
 */
public interface IOrderInfoService extends IService<OrderInfo> {

    /**
     * 拒绝订单
     * @param orderId
     */
    void refuseOrder(String orderId);

    /**
     * 生成订单
     *
     * @param orderInfoVO
     * @return
     */
    OrderInfoVO addOrder(OrderInfoVO orderInfoVO);

    /**
     * 订单确认
     *
     * @param orderInfoVO
     * @param scIdList
     */
    void confirmOrder(OrderInfoVO orderInfoVO,List<String> scIdList) throws Exception;

    Map<String, Object> sendToProvider(OrderInfoVO orderInfoVO) throws Exception;

    /**
     * 获取用户订单
     *
     * @param orderInfo
     * @return 订单信息
     */
    List<OrderInfo> getOrder(OrderInfo orderInfo);

    /**
     * 根据订单ID获取订单详细信息
     *
     * @param orderId
     * @return
     */
    OrderInfoVO getOrderDetail(String orderId);

    /**
     * 订单时效查询
     * @param proProcessParam
     * @return
     */
    List<Map<String, Object>> getProProcessInfo(ProProcessParam proProcessParam) throws ParseException;

    /**
     * 获取视频信息
     * @param saleOrderNo
     * @return
     */
    List<Map<String, Object>> getVideoInfo(String saleOrderNo,String matId);

    /**
     * 获取所有工序名称
     * @return
     */
    List<Map<String, Object>> getAllTechnologyName(String saleOrderNo,String matId);

    /**
     * 获取转换后的视频列表信息
     *
     * @param saleOrderNo
     * @return
     */
    List<Map<String, Object>> getVideoInfoList(String saleOrderNo, String matId);

    /**
     * 获取订单进度详情
     *
     * @param productProduceProcessId
     * @return
     */
    List<Map<String, Object>> getPurOrderDetail(String productProduceProcessId);

    /**
     * 导出急料表
     *
     * @param response
     * @param productProduceProcessId
     * @throws IOException
     */
    void exportOrderDetail(HttpServletResponse response, String productProduceProcessId) throws IOException;


    /**
     * 质量数据查询
     *
     * @param productQltReportParam
     * @return
     */
    List<Map<String, Object>> getProductQltReportList(ProductQltReportParam productQltReportParam) throws ParseException;

    /**
     * 成品检验数据查询
     *
     * @param isVideo
     * @return
     */
    List<Map<String, Object>> getMatTechnologyQltReportList(String qltId, String isVideo);

    /**
     * 工序检验数据查询
     *
     * @param technologyReportParam
     * @return
     */
    List<Map<String, Object>> getTechnologyReportList(TechnologyReportParam technologyReportParam);

    /**
     * 获取检验报告地址
     *
     * @return
     */
    String getTechnologyFile(String mqId);

    /**
     * 框架协议库存查询
     *
     * @param stockReportParam
     * @return
     */
    List<Map<String, Object>> getStockReportList(StockReportParam stockReportParam);

    /**
     * 导出订单时效信息
     *
     * @param response
     * @param proProcessParam
     */
    void exportOrderInfo(HttpServletResponse response, ProProcessParam proProcessParam) throws IOException, ParseException;

    /**
     * 获取导出的订单信息
     *
     * @param processInfoParam
     * @return
     */
    List<ExcelOrderInfo> getExcelOrderInfoList(ProProcessParam processInfoParam) throws ParseException;

    /**
     * 框架协议库存查询
     *
     * @param response
     * @param stockReportParam
     */
    void exportStockReport(HttpServletResponse response, StockReportParam stockReportParam) throws IOException;

    /**
     * 质量数据导出
     *
     * @param response
     * @param productQltReportParam
     */
    void exportProductQltReport(HttpServletResponse response, ProductQltReportParam productQltReportParam) throws ParseException, IOException;

    /**
     * 成品检验数据导出
     *
     * @param response
     * @param pqId
     * @param isVideo
     */
    void exportMatTechnologyQltReport(HttpServletResponse response, String pqId, String isVideo) throws IOException;

    /**
     * 工序检验数据导出
     *
     * @param response
     * @param technologyReportParam
     */
    void exportTechnologyReport(HttpServletResponse response, TechnologyReportParam technologyReportParam) throws IOException;

    /**
     * 获取质量数据下拉
     *
     * @return
     */
    List<Map<String, Object>> listDataType();

    /**
     * 插入实物订单信息
     *
     * @param orderInfoParam
     */
    void saveOrderInfo(OrderGoodsInfoParam orderInfoParam);

    /**
     * 修改订单状态
     *
     * @param orderId
     * @param orderState
     */
    void updateOrderState(String orderId, String orderState);

    /**
     * 获取买家用户所有实物订单和服务订单的状态
     *
     * @param createUser
     */
    List<OrderStateVO> getOrderSate(String createUser);

    /**
     * 根据买家用户id获取其订单
     *
     * @return
     */
    List<OrderStateVO> getOrderByUserId(String orderId);

    /**
     * 获取店铺订单列表
     *
     * @param orderInfoVO
     * @return
     */
    List<OrderInfo> getShopOrderList(OrderInfoVO orderInfoVO);

    /**
     * 重新生成服务订单
     */
    void reAddOrderService(OrderServiceVO orderServiceVO);

    /**
     * * 根据店铺ID获取店铺下的所有订单
     *      * 包括订单状态和时间的搜索
     *
     * @param orderInfoMO
     * @return
     */
    List<OrderInfoMO> getOrderInfoByCsDbId(OrderInfoMO orderInfoMO);

    /**
     *
     * 获取视频信息
     * @return
     */
    List<Map<String, Object>> getTeVideo();

    /**
     * 修改订单状态
     * @param map 订单信息
     * @return 是否修改成功的消息
     */
    Map<String,Object> updateOrderStatus(Map<String, Object> map);

    /**
     * 获取当前用户下的商品订单统计
     * @param userId
     * @return
     */
    List<Map<String, Object>> getOrderInfoByUserId(String userId);

    /**
     *获取当前用户的服务订单统计
     * @param userId
     * @param shopType
     * @return
     */
    List<Map<String, Object>> getServiceOrderInfoByUser(String userId, String shopType);

    String getMatCodeByGoodsId(String goodsDbid);
}
